//
//  DShopInfoCell.m
//  OrderSeat
//
//  Created by haiming on 13-10-14.
//  Copyright (c) 2013年 wangwei. All rights reserved.
//

#import "DShopInfoCell.h"

@implementation DShopInfoCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setContent:(NSDictionary*)dic isLastRow:(BOOL)isLastRow
{
    _titleLabel.text = [dic objectForKey:@"title"];
    _contectLabel.text = [dic objectForKey:@"text"];
    
    [self reLayoutSubviewsIsLastRow:isLastRow];
}

- (void)reLayoutSubviewsIsLastRow:(BOOL)isLastRow
{
    [_titleLabel autoLabelSize];
    
    [UIView autoLayoutHorizontal:@[_titleLabel,_contectLabel] withMargin:10];
    
    _contectLabel.width = self.width - _contectLabel.left-20;
    
    [_contectLabel autoLabelSize];
    
    [UIView autoLayoutVertical:@[_contectLabel, _line]];
    
    _line.hidden = isLastRow;
    [_line drawBorder];
    
    self.height = _line.bottom;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
